package visual;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.JLabel;

import main.GameDef;

public class Block extends JLabel implements MouseListener, GameDef{
	Color color;
	Rectangle area;
	
	public Block(int type, Point position){
		area = new Rectangle(position.x, position.y, BLOCK_WIDTH, BLOCK_HEIGHT);
		color = getPieceColor(type);
		addMouseListener(this);
	}
	
	public void paint(Graphics g){
		g.setColor(color);
		g.fillRect(area.x, area.y, area.width, area.height);
	}
	
	public Color getPieceColor(int pieceType){
		switch(pieceType){
			case ID_INTERIOR:
				return new Color(COLOR_INTERIOR);
			case ID_HOUSE:
				return new Color(COLOR_HOUSE);
			case ID_CATAPULT:
				return new Color(COLOR_CATAPULT);
			case ID_CANNON:
				return new Color(COLOR_CANNON);
			case ID_ARMORY:
				return new Color(COLOR_ARMORY);
		}
		return new Color(COLOR_DEFAULT);
	}
	
	public void mouseClicked(MouseEvent arg0) {
	}
	
	public void mouseEntered(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}
	
	public void mouseExited(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}
	
	public void mousePressed(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}
	
	public void mouseReleased(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}
}
